import random


# step_1: 分数设置
cpu_score = 0
player_score = 0


# step_2: 判断游戏者和电脑的选择
while True:
    print("------------------------------\n")
    computer = random.choice(["石头", "布", "剪刀"])
    player = input("请输入【石头/ 剪刀 /布】？输入【E】结束。\n")

    if player == computer:
        print("平局!\n")
    elif player == "石头":
        if computer == "布":
            print("你输了!", computer, "covers", player)
            cpu_score += 1
        else:
            print("你赢了!", player, "smashes", computer)
            player_score += 1
    elif player == "布":
        if computer == "剪刀":
            print("你输了!", computer, "cut", player)
            cpu_score += 1
        else:
            print("你赢了!", player, "covers", computer)
            player_score += 1
    elif player == "剪刀":
        if computer == "石头":
            print("你输了！", computer, "smashes", player)
            cpu_score += 1
        else:
            print("你赢了!", player, "cut", computer)
            player_score += 1
    elif player == "E":
        print("\n------------------------------\n")
        print("最终分数:")
        print("CPU:{}".format(cpu_score))
        print("Player:{}".format(player_score))
        print("------------------------------\n")
        break
    else:
        print("That's not a valid play. Check your spelling!")
